﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ECommerce.Model.Product;
using Jzy.Core.Common;
using ECommerce.DAL.Product;

namespace ECommerce.BLL.Product
{
    public class ECProductCommentBO : CommonOperate<ECProductCommentInfo>
    {
        private ECProductCommentDAL _productComment;
        public ECProductCommentBO()
        {
            _productComment = new ECProductCommentDAL();
        }

        public void Display(List<string> ids)
        {
            _productComment.Display(ids);
        }

        public void Hide(List<string> ids)
        {
            _productComment.Hide(ids);
        }

        public List<ECProductCommentInfo> GetDisplayList(int productID)
        {
            return _productComment.GetDisplayList(productID);
        }

        public bool HasComment(int productID, int memberID)
        {
            return _productComment.HasComment(productID, memberID);
        }

        public List<ECProductCommentInfo> GetNewCommentList()
        {
            return _productComment.GetNewCommentList();
        }

        public ECProductCommentInfo GetInfo(int productID, int memberID)
        {
            ECProductCommentInfo info = _productComment.GetInfo(productID, memberID);
            if (info == null)
            {
                info = new ECProductCommentInfo();
            }
            return info;
        }

        public override void Save(ECProductCommentInfo info)
        {
            base.Save(info);
            _productComment.SaveAvgScore(info);
        }

    }
}
